package com.sline.Singleton;

import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

public class Demo3_Timer {
    public static void main(String[] args) throws InterruptedException {
        Timer t = new Timer();
        t.schedule(new MyTimerTask(), new Date(new Date().getTime() + 1000 * 10), 3000);

        while (true) {
            Thread.sleep(1000);
            System.out.println("现在的时间是" + new Date());
        }
    }
}

class MyTimerTask extends TimerTask {
    @Override
    public void run() {
        System.out.println("我的任务");
    }
}
